package com.zdy.boot.upload.core.healthy;

import cn.hutool.http.HttpUtil;
import com.zdy.boot.upload.core.job.handler.AbstractJobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author sdy
 * @description
 * @date 2025/2/9
 */
@Slf4j
@Component
public class HealthyJob extends AbstractJobHandler {

    @Value("${seal.healthy.url}")
    private String healthyUrl;

    @Override
    public void executeJob(String param) {
        try {
            handle();
        } catch (Exception ex) {
            log.error("健康检查调用异常", ex);
        }
    }

    private void handle() {
        log.info("健康检查URL，{}", healthyUrl);
        String resp = HttpUtil.get(healthyUrl);
        log.info("健康检查结果：{}", resp);
    }

}
